var req2;
var globalIsInbox2;

function countPage(isInbox)
{
    var url = "/SRS-war/CountPageServlet?isInbox=1";
    if(isInbox == 0)
    {
        url = "/SRS-war/CountPageServlet?isInbox=0";
    }
    globalIsInbox2 = isInbox;

    if (window.XMLHttprequest)
    {
        req2 = new XMLHttprequest();
    }
    else if (window.ActiveXObject)
    {
        req2 = new ActiveXObject("Microsoft.XMLHTTP");
    }

    req2.open("Get",url,true);
    req2.onreadystatechange = callback2;
    req2.send(null);
}

function callback2()
{
    if (req2.readyState==4)
    {
        if (req2.status == 200)
        {
            var numOfPage = parseInt(req2.responseText);
            var pageRange = "";


            for(i = 1; i <= numOfPage; i++)
            {
                pageRange += "<a href='#' onclick='getMailList(" + i + ", " + globalIsInbox2
                    + ");'>&nbsp;&nbsp;" + i + "&nbsp;&nbsp;</a>";
            }

            var pageList = document.getElementById('pageList');
            pageList.innerHTML = pageRange;
            
        }
    }
}


